package org.ourgrid.broker.controller.processors;

import org.ourgrid.broker.dao.JobDAO;
import org.ourgrid.broker.scheduler.SchedulerIF;

import br.edu.ufcg.lsd.commune.container.servicemanager.ServiceManager;
import br.edu.ufcg.lsd.commune.identification.ContainerID;

public class UtilProcessor {
	
	public static SchedulerIF getScheduler(ServiceManager manager, ContainerID senderServiceID) {
		
		Integer jobID = manager.getDAO(JobDAO.class).getJobFromWorker(senderServiceID.toString());
		
		SchedulerIF scheduler = null;
		if (jobID != null) {
			scheduler = manager.getDAO(JobDAO.class).getJobScheduler(jobID);
		} else {
			//TODO log
			return null;
		}
		
		if (scheduler == null) {
			//TODO log
		}
		
		return scheduler;
	}

}
